package com.project.impl;

import com.project.service.IContry;
import com.project.service.IManService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.ImportResource;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;


@Service
public class ManServiceImpl implements IManService {
//    @Autowired //看哪个类型和IContry匹配就调用那个组件,必须只有一个实现类
//    @Qualifier("am")
    @Resource(name ="am")
    private IContry contry;

    @Value("${name}")//将属性文件中,name键对应的值赋值给当前属性
    private String name;
    @Override
    public void run() {
        System.out.println("奔跑"+name);
        contry.buid();
    }


    @PostConstruct
    public void init(){
        System.out.println("初始化方式");
    }

    @PreDestroy
    public void destroy(){
        System.out.println("销毁");
    }
}
